package com.hesicare.health.service.impl;

import com.hesicare.health.entity.SysUser;
import com.hesicare.health.mapper.SysUserMapper;
import com.hesicare.health.service.ISysUserService;
import com.hesicare.untils.StringUtil.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 55097
 */
@Service
public class SysUserServiceImpl implements ISysUserService {

    @Autowired
    private SysUserMapper sysUserMapper;

    @Override
    public int insertUser(SysUser sysUser) {
        return sysUserMapper.insertUser(sysUser);
    }

    @Override
    public SysUser getUserByLoginName(String loginName) {
        SysUser sysUser = null;
        if (StringUtil.isNotBlank(loginName)) {
            sysUser = sysUserMapper.selectUserByLoginName(loginName);
        }
        return sysUser;
    }

    @Override
    public SysUser getUserByHisUserId(String hisUserId) {
        SysUser sysUser = null;
        if (StringUtil.isNotBlank(hisUserId)) {
            sysUser = sysUserMapper.selectUserByHisUserId(hisUserId);
        }
        return sysUser;
    }

    @Override
    public void updateUser(SysUser sysUser) {
        if (sysUser != null) {
            sysUserMapper.updateUser(sysUser);
        }
    }

    @Override
    public List<SysUser> getUserByHisUserIdIsNotNull() {
        return sysUserMapper.getUserByHisUserIdIsNotNull();
    }


}
